/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.bookingmanager.adapters;

import cz.muni.fi.pa165.bookingmanager.dto.CustomerDTO;
import cz.muni.fi.pa165.bookingmanager.dto.HotelDTO;
import cz.muni.fi.pa165.bookingmanager.dto.RoomDTO;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author Jiří Holuša
 */
@Local
public interface BookingAdapter {
    
    /**
     * This method finds all free rooms in specific hotel from date given for duration in days.
     *      * 
     * @param hotel in which we want to find all free rooms
     * @param startTime from when customer want to find free rooms
     * @param duration how long he want to stay in hotel
     * @return empty List if all rooms in hotel given are booked, otherwise returns List of all free roooms in this hotel 
     */
    public List<RoomDTO> findAllFreeRooms(HotelDTO hotel, Date startTime, int duration);
    
    /**
     * Method finds all customers who has reservation in selected interval in selected hotel. Interval is calculated as follows.
     * Start of the reservation is determined by startTime parameter, parameter duration stands for number of days since startTime. So searching
     * interval is from "startTime" to "startTime + duration (days)". The whole reservation time has to be within this interval.
     * 
     * @param hotel hotel entity in which we want to search
     * @param startTime start of the search interval
     * @param duration number of days since starTime
     * @return empty List if no customers are found, otherwise List of all customers in the hotel in selected interval
     * @throws IllegalArgumentException if hotel == null || hotel.id == null
     */
    public List<CustomerDTO> findAllCurrentCustomersInHotel(HotelDTO hotel, Date startTime, int duration);
    
    /**
    * This method finds all hotels by specified conditions. Hotels will be selected by the city (city parameter),
    * maximum price(maximum price of the room in the hotel must be same or lower than maxPrice parameter) and
    * minimum capacity(minimum capacity of the room in hotel must be same or higher than minCapacity parameter).
    * @param city city where the hotel is located
    * @param maxPrice maximum price of the room in hotel
    * @param minCapacity minimum capacity of the room in hotel
    * @return empty List if no hotels are found,
    * List of all hotels if all parameters are null
    * List of all hotels by conditions
    */
    public List<HotelDTO> searchHotelByConditions(String city, BigDecimal maxPrice, int minCapacity);
    
    
    /**
     * This method find all rooms by specified conditions. Rooms will be selected by capacity and maxPrice
     * maximum price(maximum price of the room in the hotel must be same or lower than maxPrice parameter)
     * capacity of room must be same as capacity parameter
     * 
     * hotel cant be null and must be in database
     * capacity cant be 0 or less
     * maxPrice cant be null
     * 
     * @param hotel hotel entity in which we want to search
     * @param capacity capacity of room
     * @param maxPrice maximum price of room which we searching for
     * 
     * @return empty List if no room are found, otherwise List of all rooms in the hotel in selected interval
     */
    public List<RoomDTO> searchRoomInHotel(HotelDTO hotel, int capacity, BigDecimal maxPrice);    
    
}
